import request from '@/utils/request'
import type { PageParam, ResponseData } from '../commonType'

enum API {
  All_URL = '/t-vessels-type/getAll',
  PAGE_URL = '/t-vessels-type/getPage',
  ADD_URL = '/t-vessels-type/add',
  EDIT_URL = '/t-vessels-type/update',
  DELETE_URL = '/t-vessels-type/delete',
}

export function typeGetAll() {
  return request.get<any, ResponseData>(API.All_URL)
}

export function typeGetPage(data: PageParam) {
  return request.get<any, ResponseData>(API.PAGE_URL, { params: data })
}

export function typeAdd(data: any) {
  return request.post<any, ResponseData>(API.ADD_URL, data)
}

export function typeEdit(data: any) {
  return request.put<any, ResponseData>(API.EDIT_URL, data)
}

export function typeDelete(id: string | number) {
  return request.delete<any, ResponseData>(`${API.DELETE_URL}/${id}`)
}
